package com.sj.web.base.vo;

import com.sj.base.enums.GlobalEnum;

import java.io.Serializable;


/**
 * @author swallow
 * Created by swallow on 2018/9/7.<br>
 */
public class ResultVO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 成功为 1
     */
    public final static int RESULT_SUCCESS = 0X01;

    /**
     * 失败为 0
     */
    public final static int RESULT_FAILED = 0X00;

    private int result;

    private int errorcode;

    private String message = "ok";

    private Object data;

    public ResultVO() {
        super();
    }

    public ResultVO(GlobalEnum globalEnum) {
        this.result = RESULT_FAILED;
        this.errorcode = globalEnum.getCode();
        this.message = globalEnum.getMessage();
    }

    public ResultVO(GlobalEnum globalEnum, String message) {
        this.result = RESULT_FAILED;
        this.errorcode = globalEnum.getCode();
        this.message = message;
    }

    public ResultVO(int result, int errorcode, String message, Object data) {
        this.result = result;
        this.errorcode = errorcode;
        this.message = message;
        this.data = data;
    }

    public int getResult() {
        return result;
    }

    public void setResult(int result) {
        this.result = result;
    }

    public int getErrorcode() {
        return errorcode;
    }

    public void setErrorcode(int errorcode) {
        this.errorcode = errorcode;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return "ResultVO{" +
                "result=" + result +
                ", errorcode=" + errorcode +
                ", message='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
